package com.kfm.base.thread.day03;

import java.util.concurrent.ArrayBlockingQueue;

public class Demo02 {

    public static void main(String[] args) {
        ArrayBlockingQueue<String> arrayBlockingQueue = new ArrayBlockingQueue<>(1);

        arrayBlockingQueue.offer("a");

        try {
//            System.out.println(arrayBlockingQueue.offer("b", 3, TimeUnit.SECONDS));
//            arrayBlockingQueue.put("b");
            System.out.println(arrayBlockingQueue.take());
            System.out.println(arrayBlockingQueue.take());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        System.out.println(arrayBlockingQueue);
        System.out.println("end");
    }
}
